package com.aretias.jkholdings.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.aretias.jkholdings.model.Category;
import com.aretias.jkholdings.repository.CategoryRepository;

@Service
public class CategoryServiceImpl implements CategoryService {
	
	@Autowired
	private CategoryRepository categoryRepository;
	
	@Override
	public List<Category> getChild(Category param) {
		return categoryRepository.selectChildCategorys(param);
	}
	
	@Override
	public List<Category> gettAllCategorys(){
		return categoryRepository.selectAllCategorys();
	}
	
	@Override
	public Category getFirstCategory(){
		return categoryRepository.selectFirstCategory();
	}
	
	@Override
	public Category getCategoryFullName(Category param){
		return categoryRepository.selectCategoryFullName(param);
	}
	
	@Override
	public void addCategory(Category param){
		categoryRepository.insertCategory(param);
	}
	
	@Override
	public void removeCategory(Category param){
		categoryRepository.deleteCategory(param);
	}

	@Override
	public void removeChildCategory(Category param) {
		categoryRepository.deleteChildCategory(param);
	}
}
